package com.yxhl.zoume.data.http.model.trips;

import com.google.gson.annotations.SerializedName;
import com.yxhl.zoume.data.http.model.base.BaseOrder;

import java.io.Serializable;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;


/**
 * Created by sugarya on 16/3/27.
 * 行程订单
 */
public class TripOrder extends BaseOrder {


    public static final long serialVersionUID = 27L;
    /**
     * userId : 24
     * vehicleNo : A0106
     * mobile : 15321375165
     * verifyCode : 16754212
     * gmtCreate : 1454338379000
     * gmtDepart : 1454629200000
     * start : 安化
     * destination : 安化海龙
     * totalFee : 25
     * discountFee : 0
     * amount : 1
     * bizType : 5
     * src : ONLINE
     * payStatus : 7
     * rideStatus : 1
     * failReason : 订单超时,由系统关闭
     * orderType : main
     * startCity : 73705
     * endCity : 1366083384906
     * refundFee : 0
     * refundStatus : 9
     * attributes : {"GET_TICKET_MOBILE":"15321375165","IDNAME":"也一样","CLIENT_SYSTEM":"android","CLIENT_VERSION":"1.2.0","IDNUMBER":"370522198908230419","oip":"101.200.241.34","ocnk":"[{\"fee\":25.0,\"idNumber\":\"37050419\",\"name\":\"也一样\",\"type\":1,\"status\":1}]","CHIT_PRICE_FLAG":"0"}
     * attributesKeys : ["GET_TICKET_MOBILE","IDNAME","CLIENT_SYSTEM","CLIENT_VERSION","IDNUMBER","oip","ocnk","CHIT_PRICE_FLAG"]
     * id : 2016020122525905224830024
     */

    /**
     * 订单编号
     */
    @SerializedName("id")
    private String id;

    /**
     * 用户ID
     */
    @SerializedName("userId")
    private int userId;

    /**
     * 乘客手机号
     */
    @SerializedName("mobile")
    private String mobile;
    /**
     * 定制巴士取票码
     */
    @SerializedName("verifyCode")
    private String verifyCode;

    /**
     * 下单时间
     */
    @SerializedName("gmtCreate")
    private long gmtCreate;
    /**
     * 出发时间
     */
    @SerializedName("gmtDepart")
    private long gmtDepart;

    /**
     * 订单修改时间
     */
    @SerializedName("gmtModify")
    private long gmtModify;

    /**
     *
     */
    @SerializedName("title")
    private String title;

    /**
     *
     */
    @SerializedName("version")
    private String version;
    /**
     *
     */
    @SerializedName("taskId")
    private int taskId;
    /**
     * 出发地
     */
    @SerializedName("start")
    private String start;
    /**
     * 目的地
     */
    @SerializedName("destination")
    private String destination;
    /**
     * 乘车费用
     */
    @SerializedName("totalFee")
    private String totalFee;
    /**
     * 优惠金额
     */
    @SerializedName("discountFee")
    private float discountFee;
    /**
     * 乘车人数
     */
    @SerializedName("amount")
    private int amount;
    /**
     * 乘车类型
     */
    @SerializedName("bizType")
    private int bizType;
    /**
     * 支付渠道
     */
    @SerializedName("src")
    private String src;
    /**
     * 订单状态
     */
    @SerializedName("payStatus")
    private int payStatus;
    /**
     * 乘车状态
     */
    @SerializedName("rideStatus")
    private int rideStatus;
    /**
     * 请求失败原因
     */
    @SerializedName("failReason")
    private String failReason;
    /**
     * 订单类型
     */
    @SerializedName("orderType")
    private String orderType;
    /**
     * 出发城市编码(当start字段没有值时,该字段返回中文城市名)
     */
    @SerializedName("startCity")
    private String startCity;
    /**
     * 抵达城市编码(当destination字段没有值时,该字段返回中文城市名)
     */
    @SerializedName("endCity")
    private String endCity;
    /**
     * 退款金额
     */
    @SerializedName("refundFee")
    private float refundFee;
    /**
     * 退款状态
     */
    @SerializedName("refundStatus")
    private int refundStatus;
    /**
     * 乘车人信息列表
     */
    @SerializedName("attributes")
    private AttributesBean attributes;

    /**
     * 乘车人信息字段集合
     */
    @SerializedName("attributesKeys")
    private List<String> attributesKeys;


    //当bitType表示为巴士,以下字段值为接驳车司机信息/当bitType表示为快车时,字段值表示快车司机信息
    /**
     * 司机全名
     */
    @SerializedName("driverName")
    private String driverName;
    @SerializedName("driverID")
    private String driverID;
    /**
     * 司机手机号
     */
    @SerializedName("driverMobile")
    private String driverMobile;
    /**
     * 大巴或快车 司机车牌号
     */
    @SerializedName("vehicleNo")
    private String vehicleNo;//车牌号
    /**
     * 乘车人评价司机
     */
    @SerializedName("judge")
    private JudgeField judge;
    /**
     * 巴士派接驳车的订单
     */
    @SerializedName("subOrders")
    private List<TripOrder> subOrders;


    public long getGmtModify() {
        return gmtModify;
    }

    public void setGmtModify(long gmtModify) {
        this.gmtModify = gmtModify;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getVersion() {
        return version;
    }

    public void setVersion(String version) {
        this.version = version;
    }

    public int getTaskId() {
        return taskId;
    }

    public void setTaskId(int taskId) {
        this.taskId = taskId;
    }

    public String getDriverName() {
        return driverName;
    }

    public void setDriverName(String driverName) {
        this.driverName = driverName;
    }

    public String getDriverID() {
        return driverID;
    }

    public void setDriverID(String driverID) {
        this.driverID = driverID;
    }

    public String getDriverMobile() {
        return driverMobile;
    }

    public void setDriverMobile(String driverMobile) {
        this.driverMobile = driverMobile;
    }

    public JudgeField getJudge() {
        return judge;
    }

    public void setJudge(JudgeField judge) {
        this.judge = judge;
    }

    public List<TripOrder> getSubOrders() {
        return subOrders;
    }

    public void setSubOrders(List<TripOrder> subOrders) {
        this.subOrders = subOrders;
    }

    /**
     * GET_TICKET_MOBILE : 15321375165
     * IDNAME : 也一样
     * CLIENT_SYSTEM : android
     * CLIENT_VERSION : 1.2.0
     * IDNUMBER : 370522198908230419
     * oip : 101.200.241.34
     * ocnk : [{"fee":25.0,"idNumber":"37050419","name":"也一样","type":1,"status":1}]
     * CHIT_PRICE_FLAG : 0
     */


    public int getUserId() {
        return userId;
    }

    public void setUserId(int userId) {
        this.userId = userId;
    }

    public String getVehicleNo() {
        return vehicleNo;
    }

    public void setVehicleNo(String vehicleNo) {
        this.vehicleNo = vehicleNo;
    }

    public String getMobile() {
        return mobile;
    }

    public void setMobile(String mobile) {
        this.mobile = mobile;
    }

    public String getVerifyCode() {
        return verifyCode;
    }

    public void setVerifyCode(String verifyCode) {
        this.verifyCode = verifyCode;
    }

    public long getGmtCreate() {
        return gmtCreate;
    }

    public void setGmtCreate(long gmtCreate) {
        this.gmtCreate = gmtCreate;
    }

    public long getGmtDepart() {
        return gmtDepart;
    }

    public void setGmtDepart(long gmtDepart) {
        this.gmtDepart = gmtDepart;
    }

    public String getStart() {
        return start;
    }

    public void setStart(String start) {
        this.start = start;
    }

    public String getDestination() {
        return destination;
    }

    public void setDestination(String destination) {
        this.destination = destination;
    }

    public String getTotalFee() {
        return totalFee;
    }

    public TripOrder setTotalFee(String totalFee) {
        this.totalFee = totalFee;
        return this;
    }

    public float getDiscountFee() {
        return discountFee;
    }

    public void setDiscountFee(float discountFee) {
        this.discountFee = discountFee;
    }

    public int getAmount() {
        return amount;
    }

    public void setAmount(int amount) {
        this.amount = amount;
    }

    public int getBizType() {
        return bizType;
    }

    public void setBizType(int bizType) {
        this.bizType = bizType;
    }

    public String getSrc() {
        return src;
    }

    public void setSrc(String src) {
        this.src = src;
    }

    public int getPayStatus() {
        return payStatus;
    }

    public void setPayStatus(int payStatus) {
        this.payStatus = payStatus;
    }

    public int getRideStatus() {
        return rideStatus;
    }

    public void setRideStatus(int rideStatus) {
        this.rideStatus = rideStatus;
    }

    public String getFailReason() {
        return failReason;
    }

    public void setFailReason(String failReason) {
        this.failReason = failReason;
    }

    public String getOrderType() {
        return orderType;
    }

    public void setOrderType(String orderType) {
        this.orderType = orderType;
    }

    public String getStartCity() {
        return startCity;
    }

    public void setStartCity(String startCity) {
        this.startCity = startCity;
    }

    public String getEndCity() {
        return endCity;
    }

    public void setEndCity(String endCity) {
        this.endCity = endCity;
    }

    public float getRefundFee() {
        return refundFee;
    }

    public void setRefundFee(float refundFee) {
        this.refundFee = refundFee;
    }

    public int getRefundStatus() {
        return refundStatus;
    }

    public void setRefundStatus(int refundStatus) {
        this.refundStatus = refundStatus;
    }

    public AttributesBean getAttributes() {
        return attributes;
    }

    public void setAttributes(AttributesBean attributes) {
        this.attributes = attributes;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public List<String> getAttributesKeys() {
        return attributesKeys;
    }

    public void setAttributesKeys(List<String> attributesKeys) {
        this.attributesKeys = attributesKeys;
    }

    @Override
    public String toString() {
        return "TripOrder{" +
                "userId=" + userId +
                ", vehicleNo='" + vehicleNo + '\'' +
                ", mobile='" + mobile + '\'' +
                ", verifyCode='" + verifyCode + '\'' +
                ", gmtCreate=" + gmtCreate +
                ", gmtDepart=" + gmtDepart +
                ", start='" + start + '\'' +
                ", destination='" + destination + '\'' +
                ", totalFee=" + totalFee +
                ", discountFee=" + discountFee +
                ", amount=" + amount +
                ", bizType=" + bizType +
                ", src='" + src + '\'' +
                ", payStatus=" + payStatus +
                ", rideStatus=" + rideStatus +
                ", failReason='" + failReason + '\'' +
                ", orderType='" + orderType + '\'' +
                ", startCity='" + startCity + '\'' +
                ", endCity='" + endCity + '\'' +
                ", refundFee=" + refundFee +
                ", refundStatus=" + refundStatus +
                ", attributes=" + attributes +
                ", id='" + id + '\'' +
                ", attributesKeys=" + attributesKeys +
                '}';
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof TripOrder)) return false;

        TripOrder tripOrder = (TripOrder) o;

        return getId().equals(tripOrder.getId());

    }

    @Override
    public int hashCode() {
        int result = getUserId();
        result = 31 * result + getId().hashCode();
        return result;
    }

    public static class AttributesBean implements Serializable {
        private String GET_TICKET_MOBILE;
        private String IDNAME;
        private String CLIENT_SYSTEM;
        private String CLIENT_VERSION;
        private String IDNUMBER;
        private String oip;
        @SerializedName("ocnk")
        private String ocnk;
        private String CHIT_PRICE_FLAG;

        /**
         * 快车出发地的经纬度
         */
        @SerializedName("lnglat")
        private String lnglat;
        /**
         * 快车目的地的经纬度
         */
        @SerializedName("elnglat")
        private String elnglat;

        public String getGET_TICKET_MOBILE() {
            return GET_TICKET_MOBILE;
        }

        public void setGET_TICKET_MOBILE(String GET_TICKET_MOBILE) {
            this.GET_TICKET_MOBILE = GET_TICKET_MOBILE;
        }

        public String getIDNAME() {
            return IDNAME;
        }

        public void setIDNAME(String IDNAME) {
            this.IDNAME = IDNAME;
        }

        public String getCLIENT_SYSTEM() {
            return CLIENT_SYSTEM;
        }

        public void setCLIENT_SYSTEM(String CLIENT_SYSTEM) {
            this.CLIENT_SYSTEM = CLIENT_SYSTEM;
        }

        public String getCLIENT_VERSION() {
            return CLIENT_VERSION;
        }

        public void setCLIENT_VERSION(String CLIENT_VERSION) {
            this.CLIENT_VERSION = CLIENT_VERSION;
        }

        public String getIDNUMBER() {
            return IDNUMBER;
        }

        public void setIDNUMBER(String IDNUMBER) {
            this.IDNUMBER = IDNUMBER;
        }

        public String getOip() {
            return oip;
        }

        public void setOip(String oip) {
            this.oip = oip;
        }

        public String getCHIT_PRICE_FLAG() {
            return CHIT_PRICE_FLAG;
        }

        public void setCHIT_PRICE_FLAG(String CHIT_PRICE_FLAG) {
            this.CHIT_PRICE_FLAG = CHIT_PRICE_FLAG;
        }

        public String getOcnk() {
            return ocnk;
        }

        public void setOcnk(String ocnk) {
            this.ocnk = ocnk;
        }

        @Override
        public String toString() {
            return "AttributesBean{" +
                    "GET_TICKET_MOBILE='" + GET_TICKET_MOBILE + '\'' +
                    ", IDNAME='" + IDNAME + '\'' +
                    ", CLIENT_SYSTEM='" + CLIENT_SYSTEM + '\'' +
                    ", CLIENT_VERSION='" + CLIENT_VERSION + '\'' +
                    ", IDNUMBER='" + IDNUMBER + '\'' +
                    ", oip='" + oip + '\'' +
                    ", ocnk='" + ocnk + '\'' +
                    ", CHIT_PRICE_FLAG='" + CHIT_PRICE_FLAG + '\'' +
                    '}';
        }
    }
    /*
{
            "userId": 24,
            "vehicleNo": "A0106",
            "mobile": "15321375165",
            "verifyCode": "16754212",
            "gmtCreate": 1454338379000,
            "gmtDepart": 1454629200000,
            "start": "安化",
            "destination": "安化海龙",
            "totalFee": 25,
            "discountFee": 0,
            "amount": 1,
            "bizType": 5,
            "src": "ONLINE",
            "payStatus": 7,
            "rideStatus": 1,
            "failReason": "订单超时,由系统关闭",
            "orderType": "main",
            "startCity": "73705",
            "endCity": "1366083384906",
            "refundFee": 0,
            "refundStatus": 9,
            "attributes": {
                "GET_TICKET_MOBILE": "15321375165",
                "IDNAME": "也一样",
                "CLIENT_SYSTEM": "android",
                "CLIENT_VERSION": "1.2.0",
                "IDNUMBER": "370522198908230419",
                "oip": "101.200.241.34",
                "ocnk": "[{\"fee\":25.0,\"idNumber\":\"37050419\",\"name\":\"也一样\",\"type\":1,\"status\":1}]",
                "CHIT_PRICE_FLAG": "0"
            },
            "attributesKeys": [
                "GET_TICKET_MOBILE",
                "IDNAME",
                "CLIENT_SYSTEM",
                "CLIENT_VERSION",
                "IDNUMBER",
                "oip",
                "ocnk",
                "CHIT_PRICE_FLAG"
            ],
            "id": "2016020122525905224830024"
        },
        //快车的
         "attributes": {
                "ferry": "false",
                "CS": "android",
                "lnglat": "112.35317,28.567781",
                "elnglat": "112.98085,28.194546"
            },
            "attributesKeys": [
                "ferry",
                "CS",
                "lnglat",
                "elnglat"
            ],
 */
    /*
    public static final String BUS = "1"; //定制巴士
    public static final String SHUTTLE = "2";//接驳车
    public static final String SHARE = "3";//快车 (拼车）
    public static final String CHARTER = "4";//快车（包车）
    public static final String TICKET  = "5";//车票查询入口下的巴士
     */

    public class JudgeField implements Serializable {


        /**
         * 主键 ID
         */
        private Long id;
        /**
         * 用户 ID
         */
        private Long userId;
        /**
         * 司机 ID
         */
        private Long driverId;
        /**
         * 订单 ID
         */
        private Long orderId;
        /**
         * 评分
         */
        private int judgePoint;
        /**
         * 说明
         */
        private String description;
        /**
         * 评价时间
         */
        private Date gmtCreate;
        /**
         * 修改时间
         */
        private Date gmtModify;
        /**
         * 扩展属性
         */
        private Map<String, String> attributes = new HashMap<>();


        public Long getId() {
            return id;
        }

        public void setId(Long id) {
            this.id = id;
        }

        public Long getUserId() {
            return userId;
        }

        public void setUserId(Long userId) {
            this.userId = userId;
        }

        public Long getDriverId() {
            return driverId;
        }

        public void setDriverId(Long driverId) {
            this.driverId = driverId;
        }

        public Long getOrderId() {
            return orderId;
        }

        public void setOrderId(Long orderId) {
            this.orderId = orderId;
        }

        public int getJudgePoint() {
            return judgePoint;
        }

        public void setJudgePoint(int judgePoint) {
            this.judgePoint = judgePoint;
        }

        public String getDescription() {
            return description;
        }

        public void setDescription(String description) {
            this.description = description;
        }

        public Date getGmtCreate() {
            return gmtCreate;
        }

        public void setGmtCreate(Date gmtCreate) {
            this.gmtCreate = gmtCreate;
        }

        public Date getGmtModify() {
            return gmtModify;
        }

        public void setGmtModify(Date gmtModify) {
            this.gmtModify = gmtModify;
        }

        public Map<String, String> getAttributes() {
            return attributes;
        }

        public void setAttributes(Map<String, String> attributes) {
            this.attributes = attributes;
        }


        @Override
        public String toString() {
            return "JudgeField{" +
                    "id=" + id +
                    ", userId=" + userId +
                    ", driverId=" + driverId +
                    ", orderId=" + orderId +
                    ", judgePoint=" + judgePoint +
                    ", description='" + description + '\'' +
                    ", gmtCreate=" + gmtCreate +
                    ", gmtModify=" + gmtModify +
                    ", attributes=" + attributes +
                    '}';
        }
    }


}
